using System.Collections;
using System.Collections.Generic;
using UnityEngine;



[RequireComponent(typeof(AudioSource))]
public class Sound : MonoBehaviour
{
    [SerializeField] private AudioSource audioSource;

    public void SetSound(SoundDetails soundDetails)
    {
        audioSource.clip = soundDetails.RandomClip;
        audioSource.volume = soundDetails.volume;
        audioSource.pitch = Random.Range(soundDetails.soundPitchMin, soundDetails.soundPitchMin);
        audioSource.time = soundDetails.startSceond;  // 设置音频从0.1秒开始播放
        audioSource.Play();
    }
}


